package com.syh.bishe.controller;

import com.syh.bishe.pojo.Companies;
import com.syh.bishe.pojo.Log;
import com.syh.bishe.pojo.Result;
import com.syh.bishe.service.ICompaniesService;
import com.syh.bishe.service.ILogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;

/**
 * @author syh 86187
 * @date 2024/6/30
 * com.syh.bishe.controller
 * @description 测试类
 */
@RestController
@Tag(name = "CompaniesController", description = "公司模块")
@RequiredArgsConstructor
public class CompaniesController {
    private final ICompaniesService companiesService;

    @PostMapping("/companies/add")
    @Operation(summary = "添加公司信息,如果信息存在，进行更新")
    public Result add(@RequestBody Companies companies) {
        return companiesService.addCompanies(companies);
    }
    @GetMapping("/companies/getId")
    @Operation(summary = "获取公司id")
    public Result getId(@RequestParam String name) {
        return Result.success(companiesService.getId(name));
    }
    @GetMapping("/companies/getCompany")
    @Operation(summary = "获取公司信息")
    public Result getName(@RequestParam Integer id) {
        return Result.success(companiesService.getName(id));
    }

}
